package itheima04;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author xxx
 * @date 2020/12/22 3:07
 * @description
 */
public class Test {
    public static void main(String[] args) throws IOException {
        //用文件字节输出流向某个文件txt输入字母A，没有对应文件创造文件
        //将字节数组通过文件字节输出流放到对应文件中，取一部分字节数组再次存放，将3条中文语句转化为字节通过该流存放到文件里面，每放一次换一次行

        FileOutputStream fileOutputStream=new FileOutputStream("D:\\java349\\day10\\io\\fos2.txt");
        fileOutputStream.write(97);

        byte[] bytes={100,101,102,103,105,97,99};
        fileOutputStream.write(bytes);
        fileOutputStream.write("\r\n".getBytes());
        fileOutputStream.write(bytes,1,3);
        fileOutputStream.write("\r\n".getBytes());
        fileOutputStream.write("爱我中华".getBytes());
        fileOutputStream.write("\r\n".getBytes());
        fileOutputStream.write("吃饭".getBytes());
        fileOutputStream.write("\r\n".getBytes());
        fileOutputStream.write("睡觉".getBytes());
        fileOutputStream.close();


    }
}
